package com.itheima.reggie.dao;

import com.itheima.reggie.entity.ShoppingCart;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ShoppingCartDao {


    ShoppingCart findByUserIdAndDishIdOrSetmeanId(ShoppingCart shoppingCart);

    @Insert("insert into shopping_cart values(null,#{name},#{image},#{userId},#{dishId},#{setmealId},#{dishFlavor},#{number},#{amount},#{createTime})")
    void save(ShoppingCart shoppingCart);
    @Update("update shopping_cart set number=#{number} where id=#{id}")
    void update(ShoppingCart dbshoppingCart);

    @Select("select * from shopping_cart where user_id = #{userId}")
    List<ShoppingCart> findByUserId(Long userId);

    @Delete("delete from shopping_cart where user_id = #{userId}")
    void deleteByUserId(Long userId);

}
